﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;

namespace System.Web.UI
{
    public class ZMPage : ZPage
    {
        protected virtual string Command
        {
            get
            {
                return Request["Command"];
            }
        }
        protected virtual string Query
        {
            get
            {
                return Request["Query"];
            }
        }
        protected virtual string PageCode
        {
            get
            {
                return this.Page.GetType().Name.ToUpper().Replace("_ASPX", "");
            }

        }

        protected override void CheckRights()
        {
            if (ZSetup.IFUseRights)
            {
                string className = PageCode;
                if (ZRSession.Functions == null || !ZRSession.Functions.ContainsKey(className))
                {
                    Response.Redirect(ZPath.WebSite + "ZhiMa.aspx");
                }
            }

        }
        protected virtual void OnTimeOut() { }
        protected virtual void OnLoseRights() { }

        protected virtual bool IsManagerLogin
        {
            get
            {
                if (string.IsNullOrEmpty(ZSession.ManagerUID))
                    return false;
                else
                    return true;
            }
        }

        protected string GetLanguage()
        {
            string language = "/";
            if (ZLanguages.IFUseLanguage)
                language += ZLanguages.GetLanguagesType() + "/";
            return language;
        }
    }
}
